package struts.from;

import java.lang.reflect.Field;

import javax.servlet.http.HttpServletRequest;

public class FullForm {
	public FullForm () {
		
	}
	
	public static ActionForm full(String formpath,HttpServletRequest request) {
		ActionForm form =null;
		try{
			Class cla=Class.forName(formpath);
			form=(ActionForm)cla.newInstance();
			Field[] ff=cla.getDeclaredFields();
			for(Field f:ff )
				
			{
				f.setAccessible(true);
				f.set(form, request.getParameter(f.getName()));
				f.setAccessible(false);
			}

		}
		catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
		return form;
	}

}
